Optimal distribution grid allocation of reactive power with a focus on the particle swarm optimization technique and voltage stability

A structured approach to managing reactive power is imperative within the context of power systems. Among the restructuring initiatives in the electrical sector, power systems have undergone delineation into three principal categories: generation, transmission, and distribution entities, each of which is overseen by an independent system operator. Notably, active power emerges as the predominant commodity transacted within the electrical market, with the autonomous grid operator assuming the responsibility of ensuring conducive conditions for the execution of energy contracts across the transmission infrastructure. Ancillary services, comprising essential frameworks for energy generation and delivery to end-users, encompass reactive power services pivotal in the regulation of bus voltage. Of particular significance among the array of ancillary services requisite in a competitive market milieu is the provision of adequate reactive power to uphold grid safety and voltage stability. A salient impediment to the realization of energy contracts lies in the inadequacy of reactive power within the grid, which poses potential risks to its operational safety and voltage equilibrium. The optimal allocation of the reactive power load is predicated upon presumptions of consistent outcomes within the active power market. Under this conceptual framework, generators are afforded continual compensation for the provision of reactive power indispensable for sustaining their active energy production endeavors.

In reference 28 , researchers employed an ant colony optimization (ACO) algorithm to optimize the overall cost of electrical energy generated by distribution companies (Discos) and distributed generators (DGs) within the framework of the daily voltage/var control (VVC) problem.Conversely, reference 6 presented a novel fuzzy price-based compensation methodology designed to address the daily VVC conundrum in distribution systems amid the presence of DGs.Furthermore, in reference 29 , a pioneering optimization algorithm centered on a chaotic improved honey bee mating optimization (CIHBMO) approach was implemented.This algorithm facilitates the determination of critical control variables for the subsequent day, encompassing the active and reactive power of DG units, reactive power settings of capacitors, and tap positions of transformers.Similarly, reference 30 introduces a fuzzy adaptive chaotic particle swarm optimization (FACPSO) technique to address the multiobjective optimal operation management of distribution networks inclusive of fuel-cell power plants.In [31][32][33][34] , a methodology for minimizing active power losses and microgeneration shedding was proposed.This approach aims to achieve optimized and coordinated voltage support within distribution networks characterized by significant integration of DGs and microgrids.Finally, in reference [35][36][37] , an innovative approach combining an analytic hierarchy process (AHP) strategy with a binary ant colony optimization (BACO) algorithm was employed to resolve the multiobjective daily VVC problem encountered in distribution systems.The slime mold algorithm (SMA) is a nature-inspired optimization algorithm inspired by the behavior of slime molds, which are simple organisms capable of complex behaviors such as pathfinding and optimization.This algorithm is particularly useful for solving optimization problems, inspired by the ability of slime molds to find efficient routes in complex environments.In [38][39][40][41] , a sliding mode algorithm (SMA)) search strategy was proposed for solving the optimal power flow (OPF) and reactive power dispatch problem.The Runge-Kutta method is a numerical technique used for solving ordinary differential equations (ODEs) and systems of ODEs and was used for analysis and load power flow dispatch in 42 .HHO is a nature-inspired optimization algorithm in which each potential solution is represented as a bird in a population, and these birds collaborate to find the optimal solution to a given optimization problem.4][45] used the HHO method to optimize the reactive and active power flow to stabilize the voltage.
Given the significantly greater share of active power generation costs compared to reactive power generation costs, the attention devoted to the behavior of the latter in the reactive market tends to be relatively diminished.However, in fuzzy references 46,47 , a model is introduced that aims to simultaneously minimize the total cost associated with active and reactive power generation.This research endeavors to devise a model for optimizing the distribution of reactive power, taking into consideration not only the maintenance of voltage levels within permissible thresholds but also the preservation of voltage stability throughout operational phases [48][49][50][51] .
In this study, a hybrid approach incorporating the generator cross-section auction model [52][53][54][55] and static compensator cost functions is employed.Moreover, the model encompasses the calculation of both the active and reactive power outputs of generators, along with the determination of reactive power levels for compensators and the associated cost of transformer tap changers.It is noteworthy that this methodology assumes constant outcomes in the active market, with considerations also given to the temporal evolution and fluctuation of grid load.Notably, this method neglects the slack bus generator from certain considerations [56][57][58] .The motivation for using particle swarm optimization (PSO) for reactive power dispatch (RPD) in power systems arises from several factors.Complexity of the Problem: Reactive power dispatch is a complex optimization problem involving nonlinear equations, multiple constraints, and a large solution space.PSO, as a metaheuristic optimization algorithm, offers a robust and efficient way to search through this complex solution space to find near-optimal solutions.Multidimensional Search Space: Reactive power dispatch involves adjusting the settings of various reactive power devices, such as generators, capacitors, and transformers [59][60][61][62] .The ability of PSO to explore multidimensional search spaces makes it suitable for finding optimal or near-optimal configurations of these devices to improve system performance.Real-Time Application: PSO is known for its computational efficiency, which is crucial for real-time or near-real-time applications in power systems.Reactive power dispatch needs to be performed rapidly to maintain system stability and reliability, and the fast convergence properties of PSO make it suitable for such applications.Adaptability and Tunability: PSO is highly adaptable and adaptable to specific problem characteristics and requirements.This flexibility allows researchers and engineers to customize the PSO algorithm to suit the unique aspects of reactive power dispatch problems, such as incorporating penalty functions or adjusting inertia weights [63][64][65][66][67] .
The subsequent sections of the paper are structured as follows: • Section "Voltage stability margin index" discusses the voltage stability margin and examines its correlation with the power grid load and stability.• Section "Optimal reactive power planning model" elucidates the planning model devised for reactive power, outlining its fundamental principles and methodologies.• Sections "Problem objective function" and "Inequality constraints" are dedicated to identifying the objective function and constraints inherent in the proposed model, respectively.• Section "Using particle swarm optimization to solve the second mode optimization" provides an in-depth explanation of the Particle Swarm Optimization (PSO) algorithm utilized for optimizing the model, along with the presented results.• The concluding section encapsulates the findings and implications drawn from the study, offering insights and potential avenues for future research.

Voltage stability margin index
There is currently a strong economic incentive to utilize the entire capacity of the electricity system [68][69][70][71] .The independent grid operator must be aware of the stability status and the distance to the edge of grid instability since rising power generation and demand are pushing the system to the point of instability [29][30][31]34 . It s a valuable indicator for making judgments since it can quantify the distance from the absolute location of the system's instability to the grid operator.The grid load limit index, which can be used as a gauge of the maximum voltage stability margin, is the sole indicator that possesses this property [72][73][74][75] .The voltage diagram is shown in Fig. 1 as a power diagram, where vsm denotes the system's loading parameter.This graph demonstrates that even when the system's overall load is increased by a factor of vsmP 0 , voltage collapse does not occur.

Optimal reactive power planning model
This section presents a model that integrates operational reactive power management considerations.Voltage stability, a critical aspect influenced by various factors, including the spatial arrangement and magnitude of active power generation across the grid, the configuration of the distribution system, and the placement of reactive power supply assets [40][41][42] , is of paramount importance.In light of these multifaceted determinants, this section endeavors to delineate a reactive power distribution system that not only prioritizes voltage stability during operational phases but also ensures the preservation of voltage amplitude within acceptable limits.

Problem objective function
With increasing system load, Q GENi and Q SHi in the equation below indicate the reactive energy obtained from the i-th generator and the i-th static compensator, respectively.P slack GEN is the additional power obtained from the slack bus generator to increase the load and offset losses, and T Ti is the modification to the ith transformer's conversion ratio.γ Ti The cost of reactive electricity generated by the i-th generator is determined by the i-th generator's auction price function and this statement.The cost of acquiring static reactive power compensation for the grid is included in the second expression to the right of this equation, and the cost of changing the taps on transformers is included in the third expression.The final sentence also includes the price of the electricity drawn from the slag bus generator.

Equality constraints
The equality of the active and reactive power produced with consumption is one of these restrictions.In this instance, it is presumable that generators are the only source of the necessary reactive power.Both the zero voltage angle of the slack bus and the stability of the voltage size of the bus with the generator are considered equal constraints.The active power equalization limits only consider the active power produced by the slack bus generator when the system experiences a rapid increase in load during operation.The reactive power equalizer restrictions also include static compensators in addition to generators.In this case, the stability of the active power produced by the generators, with the exception of the slack bus generator, is regarded as an equality requirement. (1) Voltage diagram in terms of the power grid load and voltage stability.

Inequality constraints
Static compensators, generator output power, and reactive power generation or absorption capacity are used as inequality restrictions.The permitted range of changes in the transformer Tap, the temperature limit of the transmission lines, and the size and angle of the bus voltage are further inequality restrictions.The reactive power auction for a generator's entire curve is shown in Fig. 2. Figure γ GENi shows the reactive power obtained from the i-th generator cost.A generator's maximum reactive power output is determined by the quantity of active power generation, following its operating capability curve.Taking the Slack Bass generator used in this project as an example, the auction function is as follows: The price per megawatt of production is calculated at $15, with the cost of creating reactive power for static compensators being considered to be fixed.Moreover, the price per unit to replace the transformer's tap is $15.This system has 12 transformers with tap changers, 4 reactive power compensators installed in buses 4, 8, 15, and 27, and 10 generators.The term "slack bus generator" is used to describe the generator linked to bus 31 (see Fig. 3).
This section presents the results obtained from computations conducted using MATLAB software tools.The outcomes of optimization utilizing the Particle Swarm Optimization (PSO) algorithm will be discussed in a subsequent section, accompanied by a comparative analysis against existing methodologies.The analysis commences with the allocation of active power over a specific time period.Initially, generators constitute the sole source of reactive power required for the system.Subsequently, a scenario in which there is an unexpected increase in the total active power demand by a factor of ζ = 0.01 following the optimal allocation of active power to the grid's top is considered.In response to this situation, a decrease in bus voltages is observed, necessitating the provision of reactive power to rectify the voltage reduction.Furthermore, it is assumed that the active power output of the generators, excluding the slack bus generator, remains constant.
Following the resolution of the model, the following conclusions are drawn for both scenarios.The active and reactive power allocations for the generators are detailed in Table 1, while Table 2 presents the reactive power ratings for the static compensators.The transformer tap changer specifications are provided in Table 3, and the quantities and voltage angles of the buses are tabulated in Table 4. Additionally, Table 5 delineates the associated expenditures for each state, along with the supplementary costs incurred in the second state.

Using particle swarm optimization to solve the second mode optimization
This paper initially introduces the proposed methodology employed herein, followed by an elucidation of the Particle Swarm Optimization (PSO) technique.The PSO method, an optimization approach inspired by simulated animal behavior, originated in the 1990s.Specifically, Eberhart and Kennedy pioneered a technique for PSO based on behavioral analogies observed in fish and birds.A notable characteristic of this method is its capacity to operate based on relatively simplistic rules.
The underlying principle of the PSO technique revolves around the concept that individuals base their decisions on two types of information: personal experiences and observations of others' experiences.Individuals explore various options to discern their relative superiority and desirability, drawing upon their own past encounters.Additionally, they also consider the behaviors and outcomes of those in their proximity, leveraging external experiences to inform their decision-making process.Therefore, using the following information, each particle strives to enhance its position: • Vector of the current position   • The distance between the current position and the most advantageous position encountered • The separation between the present position and the particle swarm's optimal position The following equations can be used to formulate position adjustment, in accordance with the aforementioned sentences: and where z N i is the current position of the i-th particle in the k-th iteration, pbest i is the best position the i-th part has ever experienced, and gbest is the best experienced position of the particle swarm.V N i is the velocity vector of the i-th particle in the k-iteration, w is the weighting function, J j is the weighting coefficient, and rand is the random vector of particle i between zero and one.Additionally, M max and M min are the highest and lowest weights, respectively, iter max is the number of repetitions, and iter is the current repetition.
Experience has demonstrated that the following values M min = 0.4 and M max = 0.4 J j = 2 for these param- eters are appropriate for power system issues.The main advantages of this technique are shown in Fig. 4: This research proposes an approach that surpasses customary methods in both accuracy and speed.Specifically, if a particle's current position in each iteration proves to be inferior to its best-experienced position, an adjustment is made to its velocity vector.This adjustment aims to propel the particle's future position away from its current location, thereby averting movement toward unfavorable conditions in subsequent cycles.This adjustment is mathematically expressed as follows: where pworse i is the place prior to the I particle that has poor experience.To address the optimal distribution of reactive power during operation, it is essential to define the variable vector for each particle.The grid under consideration encompasses 39 buses and 12 transformers equipped with tap changers, resulting in a total of 90 entries for each particle's variable vector.Specifically, the first 39 entries pertain to the bus voltage magnitude, the subsequent 39 entries correspond to the bus voltage phase angle, and the final 12 entries are associated with the tap settings of the transformers.
In this optimization strategy, 200 particles were employed, and 100 iterations were conducted to ensure convergence.The optimization outcomes achieved through this method are illustrated in Fig. 5, which also displays the power generated by generators before and after a significant increase in load.The transformer tap changer settings are provided in Table 6, while Table 7 outlines the allocated reactive power for the static compensators.Tables 8 and 9 present the quantities and voltage angles of the buses.Furthermore, Table 10 provides details on the expenditures associated with each mode, including the additional costs incurred in the second mode.
The active generating power of generators using two optimization techniques is compared in Fig. 6.In Fig. 7, two approaches to maximizing the reactive power produced by generators are compared.Figure 8 An unexpected increase in the load's additional cost using two different techniques. (3)

Conclusions and discussion
Reactive power plays crucial roles in power system reliability and security.Market participants utilize the network differently to maximize their profits.This means that their effects on the system, such as losses, can also be different.The development of a fair and accurate loss allocation scheme for real and reactive power is important for avoiding cross subsidies and obtaining the correct charge for each participant.To minimize costs, this paper introduces a model for the optimal allocation of reactive power.Technically, this model utilizes the voltage stability margin as a safeguard for operational safety and ensures the attainment of maximum active power contracts in the market from an economic standpoint.Reactive power provision is regarded as an additional service within     this framework.The efficacy of the proposed model has been evaluated using the 39-bus IEEE system, and simulation results employing the particle swarm optimization algorithm showcase its ability to achieve optimal reactive power allocation during operation, notwithstanding the constraints of the market environment.

Figure 2 .
Figure 2. Generic generator auction curve for reactive power.

Figure 4 .
Figure 4. General process of particle swarm optimization.

Figure 5 .
Figure 5. Amount of objective function (additional cost in dollars) during 100 repetitions.

Figure 6 .
Figure 6.Comparison of two optimization techniques in terms of the active generating power of generators.

Figure 7 .
Figure 7.Comparison of two methods for optimizing the reactive power generated by generators.

Figure 8 .
Figure 8.The additional cost of a sudden increase in load in the two methods.

Table 1 .
Active and reactive power allocated for generators.

Table 2 .
Assigned reactive power of the static compensators.

Table 4 .
Amount and voltage angle of the buses.

Table 5 .
The related costs of each state as well as the additional costs incurred in the second state.

Table 6 .
Amount of active and reactive power generated by generators before and after sudden increase in load.

Table 8 .
Assigned reactive power of the static compensators.

Table 9 .
Amount and voltage angle of buses.

Table 10 .
Costs corresponding to each mode and additional costs imposed in the second mode.